package top.huntwolf.admin.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import top.huntwolf.admin.pojo.User;
import top.huntwolf.admin.pojo.cmsUser.*;

import java.util.List;

/**
 * description:
 * author:zt
 * date:2021-10-23
 */
@Mapper
@Repository
public interface CMSUserDao {

    CMSUser findUserByName(String username);

    void updateUser(CMSUser user);

    int insert(CMSUser user);

    List<CMSUser> findSubUser(Role role);

    List<Role> selectRoleByUserId(Integer id);

    List<Permission> selectPermissionByRoleId(Integer id);

    void insertRole(Role role);

    int insertUserAndRole(List<UserRole> userRole);

    void insertPermission(Permission permission);

    int insertRoleAndPermission(List<RolePermission> rolePermission);

    List<Role> findSubRole(Role role);

    Role selectRoleByUserIdAndWeight(int id);

    List<Permission> findPermission(CMSUser user);

    Role selectRole(int id);

    int deleteUserAndRole(List<UserRole> userRoles);

    int deleteRoleAndPermission(List<RolePermission> rolePermissions);

    CMSUser selectUserById(Integer id);

    List<Permission> selectPermissionByRoute(Integer routeId);

}
